//
//  TLCollectionListCollectionViewCell.m
//  WXReader
//
//  Created by huaya on 2025/3/29.
//  Copyright © 2025 Andrew. All rights reserved.
//

#import "TLCollectionListCollectionViewCell.h"

@interface TLCollectionListCollectionViewCell ()

@property (weak, nonatomic) IBOutlet UIButton *tagsBtn;
@property (weak, nonatomic) IBOutlet UIImageView *imgView;
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@property (weak, nonatomic) IBOutlet UIButton *checkBtn;
@property (weak, nonatomic) IBOutlet UIView *maskView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *tagsConst;

@end

@implementation TLCollectionListCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.imgView.layer.cornerRadius = 8;
    self.maskView.hidden = YES;
    self.checkBtn.hidden = YES;
    
}
- (void)setIsAllSelected:(BOOL)isAllSelected{
    _isAllSelected = isAllSelected;
    
    if (isAllSelected) {
        self.maskView.hidden = NO;
        self.tagsBtn.hidden = YES;
        self.checkBtn.hidden = NO;
        self.checkBtn.selected = YES;
        
    }else{
        self.maskView.hidden = YES;
        self.tagsBtn.hidden = NO;
        self.checkBtn.hidden = YES;
        self.checkBtn.selected = NO;
    }
    
}
- (IBAction)checkAction:(UIButton *)sender {
    sender.selected = !sender.selected;
    
    if (self.selectedBlock) {
        self.selectedBlock(_dataModel.production_id);
    }
    
    
}
- (void)setDataModel:(TL_ProductionModel *)dataModel{
    if (dataModel) {
        _dataModel = dataModel;
        
        [self.imgView sd_setImageWithURL:[NSURL URLWithString:_dataModel.cover]];
        
        self.titleLab.text = _dataModel.name;
        self.tagsBtn.selected = !dataModel.isEnd;
        if (dataModel.isEnd) {
            self.tagsConst.constant = 83;
        }else{
            self.tagsConst.constant = 62;
        }
        
    }
}
- (void)setIsEidt:(BOOL)isEidt{
    _isEidt = isEidt;
    
    if (isEidt) {
        self.maskView.hidden = NO;
        self.tagsBtn.hidden = YES;
        self.checkBtn.hidden = NO;
    }else{
        self.maskView.hidden = YES;
        self.tagsBtn.hidden = NO;
        self.checkBtn.hidden = YES;
    }
    
}

@end
